<?php

include './functions.php';

$p = $_POST['p'];

$num = 5;

// 读老数据 
$oldData = file_get_contents('./data/db.txt');
// 把json数据转成数组 
$oldData = json_decode($oldData,true);

///根据所在页进行取数组的一部分
$oldData = array_slice($oldData,($p-1)*$num,$num,true);


foreach ($oldData as $k => $v) {
	$oldData[$k]['ctime'] = Ftime($v['ctime']);
}

if($oldData){
	exit(json_encode(['code'=>0,'data'=>$oldData]));
}else{
	exit(json_encode(['code'=>1,'msg'=>'数据已没有']));
}